home *** CD-ROM | disk | FTP | other *** search
- A Lightwave to Open Inventor 3D object converter
- ------------------------------------------------
-
- This directory contains a fairly simplistic 3D object conversion program to
- convert from the Lightwave 3D object file format into Open Inventor 2.0 files.
- It was developed on an SGI, and the source will only compile on a machine with
- C++ and the Open Inventor developer's option installed. For those people
- without C++ or the Open Inventor developer's option, I have included an
- executable that should run on any SGI machine running IRIX 5.3 that supports
- OpenGL and Open Inventor.
-
-
- USAGE
-
- The Lightwave object file name is read from the command line, and the
- Open Inventor file is output to stdout.
-
- So to create an ascii Open Inventor object from an existing Lightwave file,
- just type something like:
-
- lwtoiv lightwave_file >inventor_file
-
- I created this converter so I could use my SGI at work to preview many of
- the lightwave objects I download from various ftp sites on the internet. So
- to quickly preview a Lightwave object, try this:
-
- lwtoiv lightwave_file | ivview
- or
- lwtoiv lightwave_file | /usr/demos/Inventor/gview
-
- Both of these commands will pipe the output to an Open Inventor viewer that
- will allow you to translate, rotate, or zoom in and out of the object. The
- second command will also show you the hierarchical node structure of the
- resulting Open Inventor object, and allow you to edit some parts of the
- structure or individual fields in each node of the structure.
-
-
- LIMITATIONS / PROBLEMS / BUGS
-
- As I mentioned earlier, this is just a simplistic converter used mainly for
- previewing Lightwave objects before I take them home to my trusty old Amiga.
- For that reason, many features found in a Lightwave file are ignored or are
- just not converted correctly into Open Inventor format. Here is a list of
- most of the limitations of this converter.
-
- All textures and reflection maps are ignored. Maybe someday I'll add the
- ability to handle reflection maps and color textures.
-
- The shading model used by Lightwave is slightly different than that used
- by Inventor. The converter uses some of my own guesses as to how to
- convert between the color, diffuse, specular, glossiness, luminance, and
- transparency parameters of Lightwave to the diffuse, ambient, specular,
- emissive, shininess, and transparency parameters of Inventor.
-
- For some objects, the default smoothing angle of Lightwave (89.5 degrees
- which is 1.56207 radians) causes objects to look strange (too smoothed??)
- when used as Inventor's crease angle. You can often change the crease
- angle in the Inventor nodes to improve the appearance of smoothed objects.
- The program gview (mentioned above in the USAGE section) is an excellent
- tool for experimenting with different crease angles (look for the
- creaseAngle field in the ShapeHints node). Remember, the crease angle
- in Inventor should be specified in radians.
-
- Inventor does not handle the wide variety of polygon shapes allowed by
- Lightwave. By default, OpenGL (the software interface upon which the Open
- Inventor toolkit is based) assumes polygons must be convex. OpenGL does
- provide some utility routines that Open Inventor uses to try and tesselate
- concave poygons into groups of convex poygons, but these tesselation
- routines still can not cope with all the polygon shapes allowed in Lightwave.
- Here is a brief rundown on how I handle (or ignore) these problems:
-
- a) I test for repeated vertices in a polygon, and if found, create a
- polyline node instead of a polygon and output a message to stderr that
- informs the user as to which surface(s) contains polylines. I output
- this message so that it is easy for an experienced Inventor user to
- search for the polyline occurences in the Inventor file, and then
- edit the file by hand to try and rectify this situation (for most
- occurences of this problem I have only had to exert a small amount
- of manual effort to convert the SoIndexedLineSet node back into the
- appropriate SoIndexedFaceSet node). The following diagram depicts
- a common situation in Lightwave objects in which this occurs (a
- polygon with a hole):
-
- *---------------------*
- | /|
- | / |
- | / |
- | *------------* |
- | | | |
- | | | |
- | | | |
- | *------------* |
- | |
- | |
- *---------------------*
-
-
- b) The other situation that Inventor does not like is when a vertex lies
- on an existing edge of the polygon (self-intersecting polygon). I do
- nothing to test for this situation, and Inventor outputs its own error
- message, then does not create the polygon. Here are 2 diagrams of
- polygons in which I have seen this problem:
-
-
- *-------*-------* * *
- | | |\ /|
- | | | \ / |
- | | | \ / |
- | | | \ / |
- *---------------* *----*----*
-
- These problems could be solved by an experienced Inventor user in the
- same way as problem a), but it was not as simple for me to test for
- this problem. Since I do not test for this situation, Inventor finds
- the problem and just skips over the offending polygon altogether, no
- polyline node is created to help rectify the situation. The offending
- polygon still exists in the Inventor file, so if it can be found it
- can be corrected (its just not as easy to find the offending polygon
- as it is when it is seperated into its own polyline node).
-
- Well, that's the major problems with this converter, I'm sure there are others
- I don't know about or just forgot to mention here. If you find other problems
- or just have any suggestions about the converter, please feel free to contact
- me. I am always glad to hear any suggestions or criticisms, just realize that
- I may not have the time or the inclination to do anything else to this code,
- since it does the majority of the things I created it for.
-
- Marvin Landis
- marvinl@amber.rc.arizona.edu
-